#include "settingspagemanger.h"
static QWidget *displaying_page=nullptr;
SettingsPageManger::SettingsPageManger()
{

}
void SettingsPageManger::switchToPage(QWidget *w, PageType type)
{
    if(displaying_page){
        displaying_page->close();
    }
    switch(type){
    case ACCOUNTPAGE:
        displaying_page=new AccountArea(w);
        break;
    case MESSAGEPAGE:
        displaying_page=new MessageArea(w);
        break;
    case CURRENCYPAGE:
        displaying_page=new CurrencyArea(w);
        break;
    case FILEPAGE:
        displaying_page=new FileArea(w);
        break;
    case ABOUTPAGE:
        displaying_page=new AboutArea(w);
        break;
    }
    displaying_page->setAttribute(Qt::WA_DeleteOnClose);
    displaying_page->show();
}

void SettingsPageManger::deletePage()
{
    delete displaying_page;
    displaying_page=nullptr;
}
